package org.einbazen.xmlliteratuur;
import java.io.*;

public class CSVparser {
	private final String CSV_DELIMITER = ";";
	private int counter = 0;
	
	public CSVparser()
	{
		try
		{
			BufferedReader bf = new BufferedReader(new FileReader("File.csv"));
			String line = bf.readLine();
			while (line != null)
			{
				ParseLine(line);
				line = bf.readLine();
			}
		}
		catch (Exception e)
		{
			System.out.println(e);
		}
	}
	
	private void ParseLine(String csl) throws Exception
	{
		String[] exploded = csl.split(CSV_DELIMITER);
		
		if (exploded.length != 8)
			throw new Exception("Invalid line found!");
		
		System.out.println("----------- " + counter + "-----------");
		for (String str : exploded)
		{
			System.out.println(str);
		}
		counter++;
	}
}
